package cn.webrx;

import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.crypto.hash.Sha512Hash;
import org.apache.shiro.crypto.hash.SimpleHash;

/**
 * <p>功能描述: </p>
 *
 * @author webrx
 * @version 1.0
 * @date 2020-06-08 17:29
 */
public class Demo {
    public static void main(String[] args) {
        //md5 21232f297a57a5a743894a0e4a801fc3
        Md5Hash md5 = new Md5Hash("admin");
        System.out.println(md5);
        //salt 加盐 wx  070c12d6eb92e9b260c035b9859980a9
        Md5Hash md6 = new Md5Hash("admin","wx");
        System.out.println(md6);
        //散列1000次
        Md5Hash md7 = new Md5Hash("admin","wx",1000);
        System.out.println(md7);

        SimpleHash sh = new SimpleHash("md5","admin","wx",1000);
        System.out.println(sh.toString());//32位
        System.out.println(sh.toString().length());

        //Sha512Hash admin密码 wx 盐 10次散列
        Sha512Hash ssh = new Sha512Hash("admin","wx",10);
        System.out.println(ssh.toString());//128位
        System.out.println(ssh.toString().length());
    }
}
